package com.hikvision.cms.common.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;


public class DateUtil {
    private static final String DEFAULT_FORMAT = "yyyy-MM-dd HH:mm:ss";

    public static String getNowStr() {
        return getDateStr(new Date());
    }


    public static Date getNowDate() {
        return new Date();
    }


    public static String getDateStr(Date date) {
        return (new SimpleDateFormat(DEFAULT_FORMAT)).format(date);
    }


    public static Date getDate(Date date, int month) {
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        c.add(2, month);
        return c.getTime();
    }


    public static Date getNextMonthDate() {
        return getDate(getNowDate(), 1);
    }
}


